package com.kitty.web.system.info.service.impl;


import com.kitty.game.attribute.config.Attribute;
import com.kitty.game.config.Equip;
import com.kitty.game.config.NewPetSet;
import com.kitty.web.system.info.service.IZhuangbeiInfoService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 装备信息Service业务层处理
 * 
 * @author soul
 * @date 2020-05-10
 */
@Service
public class ZhuangbeiInfoServiceImpl implements IZhuangbeiInfoService
{
    @Autowired
    Dao dao;

    /**
     * 查询装备信息列表
     * 
     * @param equip 装备信息
     * @return 装备信息
     */
    @Override
    public List<Equip> selectZhuangbeiInfoList(Equip equip)
    {
        Cnd where = Cnd.where("1", "=", "1");
        if(equip.getPosition() != 0){
            where.and("position","=",equip.getPosition());
        }
        if(equip.getReq_level() != 0){
            where.and("req_level","=",equip.getReq_level());
        }
        if(equip.getKey_name() != null){
            where.and("key_name","=",equip.getKey_name());
        }
        return dao.query(Equip.class, where);
    }

    @Override
    public List<Attribute> selectGameAttributeList(Attribute attribute) {

        return null;
    }

    @Override
    public List<NewPetSet> selectPPetsetList(NewPetSet newPetSet) {
        return dao.query(NewPetSet.class, Cnd.NEW());

    }

    @Override
    public List<NewPetSet> selectPetset(NewPetSet newPetSet) {
        return dao.query(NewPetSet.class, Cnd.where("name","=",newPetSet.getName()));
    }

}
